home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 42
/
Amiga Format AFCD42 (Issue 126, Aug 1999).iso
/
-serious-
/
programming
/
other
/
gui4cli
/
gui4cli.gc
< prev
next >
Wrap
Text File
|
1999-05-14
|
17KB
|
690 lines
G4C
; Gui4Cli.gc
; =================================================================
; This is the gui which is opened when you click the "Prefs" button
; on the Gui4Cli requester.
; If you find yourself feeling queezy after having suffered the full
; effect of it's poping open at you unwarned, you may change it as
; you see fit.. - set TABs to 3 -
WINBIG 227 26 299 201 "Gui4Cli"
WinType 11110001
BOX 0 0 297 201 out button
; -----------------------------------------------------------------
; System events
; -----------------------------------------------------------------
xOnLoad
setgadvalues gui4cli.gc ; set default values
path = $$G4C.editor ; update path shown
update #this 84 $path
sndfx = $*SNDGAD ; update sound fx shown
update #this 89 $sndfx
setgad gui4cli.gc 72 off
mode = GUI
setgad #this 903 hide ; palette lv
palette = 0
lvhelp = 'Choose guis to load'
oldguidir = GUIs:
update gui4cli.gc 50 'Port: $$g4c.port'
gosub gui4cli.gc SetGuiStat ; starting state
guiopen Gui4Cli.gc
xonreload
guiopen Gui4Cli.gc
guiscreen gui4cli.gc front
xOnOpen
SetGad Gui4Cli.gc 1 OFF ; remove the appicon
if $mode = LOAD ; refresh stuff..
lvuse Gui4Cli.gc 10
lvdir refresh
elseif $mode = GUI
lvuse Gui4Cli.gc 54
lvdir #env:$$g4c.port
endif
xOnClose
SetGad Gui4Cli.gc 1 ON ; open the appicon
xOnFail
ezreq "Failed.." OK ""
xAppIcon 0 0 GUIs:Gui4Cli "Gui4Cli" apivar OFF
GadID 1
GuiOpen Gui4Cli.gc
GuiScreen Gui4Cli.gc FRONT
if $apivar > ' '
andifexists DIRECTORY $apivar ; if a directory or volume icon was
orifexists DOS $apivar ; dropped on the icon,
lvuse Gui4Cli.gc 10 ; we cd to it..
lvdir #$apivar
endif
; ****** ENABLE THIS HOT KEY IF YOU WANT IT ******
; xHotKey "rawkey shift f1" ON ; popup key for this gui
; guiopen #this
; guiscreen #this front
; guiwindow #this front
; -----------------------------------------------------------------
; Mode CYCLER
; - will rotate gui through all modes
; -----------------------------------------------------------------
XBUTTON 9 5 80 14 "Guis"
gadid 801
gadhelp '- List of loaded Guis'
gosub #this SetGuiStat ; because it's also called from xOnLoad
xRoutine SetguiStat
mode = GUI
setgad gui4cli.gc 10 HIDE ; the listview
setgad gui4cli.gc 50/59 SHOW ; other lv & Open/close/quit etc
setgad gui4cli.gc 60/100 HIDE
lvuse Gui4Cli.gc 54
lvdir #env:$$g4c.port
setwintitle gui4cli.gc 'Port $$g4c.port : Home'
changearg #this 801 3 16
changearg #this 802 3 14
changearg #this 803 3 14
partredraw gui4cli.gc 4 17 291 181
XBUTTON 90 5 80 14 "Load"
gadhelp '- Load Guis'
gadid 802
mode = LOAD
setgad gui4cli.gc 10 SHOW
setgad gui4cli.gc 50/58 HIDE
setgad gui4cli.gc 59 SHOW
setgad gui4cli.gc 60/79 SHOW
setgad gui4cli.gc 80/100 HIDE
lvhelp = 'Choose guis from here'
setwintitle gui4cli.gc '$oldguidir'
changearg #this 801 3 14
changearg #this 802 3 16
changearg #this 803 3 14
partredraw gui4cli.gc 4 17 291 181
XBUTTON 171 5 80 16 "Prefs"
gadhelp '- Set general preferences'
gadid 803
mode = SET
setgad gui4cli.gc 10 HIDE
setgad gui4cli.gc 50/79 HIDE
setgad gui4cli.gc 80/89 SHOW
; reset tab and grid
update #this 87 $$g4c.tab
update #this 86 $$g4c.grid
setwintitle gui4cli.gc 'Gui4Cli settings'
changearg #this 801 3 14
changearg #this 802 3 14
changearg #this 803 3 16
partredraw gui4cli.gc 4 17 291 181
; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; -----------------------------------------------------------------
; GUI mode
; Open, Close, unload GUIs...
; -----------------------------------------------------------------
; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; ------ The listview
XLISTVIEW 6 66 285 132 "" guivar '' 0 DIR
gadid 54
gadfont #mono 8 000
gadhelp 'These are the guis currently loaded'
extract guivar file fname
guiopen $fname
TEXT 105 25 174 15 port 35 BOX
gadid 50
XBUTTON 15 45 20 14 "R" ; refresh list
gadid 51
gadhelp 'Refreshes the list of loaded guis'
lvuse Gui4Cli.gc 54
lvdir refresh
XBUTTON 40 45 58 14 Open
gadid 51
gadhelp 'Will open the selected guis'
lvuse Gui4Cli.gc 54
lvmulti first
while $guivar > ''
extract guivar file fname
guiopen $fname
lvmulti next
endwhile
lvdir none
XBUTTON 100 45 58 14 Close
gadid 52
gadhelp 'Will close the selected guis'
lvuse Gui4Cli.gc 54
lvmulti first
while $guivar > ''
extract guivar file fname
guiclose $fname
lvmulti next
endwhile
lvdir none
XBUTTON 160 45 58 14 Unload
gadid 53
gadhelp 'Will quit the selected guis'
lvuse Gui4Cli.gc 54
lvmulti first
while $guivar > ''
extract guivar file fname
guiquit $fname
lvmulti next
endwhile
; the guis won't actually quit until all commands have executed, so..
reflag = 1
xAfter
if $reflag = 1
reflag = 0
lvdir refresh
endif
XBUTTON 235 45 20 14 "A" ; also shown in gui mode
gadhelp 'Select all items'
gadid 51
lvuse Gui4Cli.gc 54
lvdir all
XBUTTON 255 45 20 14 "N"
gadhelp 'Unselect all items'
gadid 51
lvuse Gui4Cli.gc 54
lvdir none
BOX 6 20 284 44 in button
GADID 59
CTEXT 18 27 'GUI Control' #screen 8 2 0 0001
gadid 50
; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; -----------------------------------------------------------------
; LOAD mode
; Load GUIs...
; -----------------------------------------------------------------
; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XLISTVIEW 6 66 285 132 "" guivar GUIs: 0 DIR
gadid 10
gadfont #mono 8 000
gadhelp 'Listview : $lvhelp' ; we set it above according to mode
docase $mode
case = FAV
setgad gui4cli.gc 71 on ; if double clicked in FAV mode
setgad gui4cli.gc 60/63 on ; set it back to LOAD mode
setgad gui4cli.gc 72 off ; and cd to selection
lvhelp = 'Choose guis to load'
lvmode DIR
lvdir #$guivar
mode = LOAD
break
case = LOAD
if $guivar H= G4C
guiload $guivar
endif
break
endcase
xlvdirhook 10
if $mode = LOAD
oldguidir = $$lv.dir
setwintitle gui4cli.gc '$oldguidir'
endif
; ----- for the box use the same as above (gadid 59)
CTEXT 20 27 GuiLoad #screen 8 2 0 0001
gadid 60
XBUTTON 24 42 80 14 Load ; load
gadhelp 'Will load the selected files if they are guis'
gadid 60
lvuse Gui4Cli.gc 10
lvmulti first
while $guivar > ''
if $guivar H= G4C
guiload $guivar
endif
lvmulti next
endwhile
lvdir none
XBUTTON 117 42 20 14 "P"
gadhelp 'CD to Parent dir'
gadid 60
lvuse Gui4Cli.gc 10
lvdir parent
oldguidir = $$lv.dir
setwintitle gui4cli.gc '$oldguidir'
XBUTTON 138 42 20 14 "D"
gadhelp 'Show Volumes list'
gadid 60
lvuse Gui4Cli.gc 10
lvdir disks
oldguidir = ''
setwintitle gui4cli.gc 'Devices'
XBUTTON 171 42 20 14 "G"
gadhelp 'Shortcut to GUIs:'
gadid 60
lvuse Gui4Cli.gc 10
lvdir #Guis:
oldguidir = GUIs:
setwintitle gui4cli.gc 'GUIs:'
XBUTTON 117 27 20 14 "A" ; also shown in gui mode
gadhelp 'Select all items'
gadid 60
lvuse Gui4Cli.gc 10
lvdir all
XBUTTON 138 27 20 14 "N"
gadhelp 'Unselect all items'
gadid 60
lvuse Gui4Cli.gc 10
lvdir none
; ---------------- Favourite Loading dirs
XBUTTON 192 27 58 14 "Fav"
gadid 70
gadhelp 'Switches to and from Favourites mode'
lvuse gui4cli.gc 10
if $mode = FAV
setgad gui4cli.gc 71 on
setgad gui4cli.gc 60/63 on
setgad gui4cli.gc 72 off
lvhelp = 'Choose guis to load'
lvmode DIR
lvdir #$oldguidir
mode = LOAD
else
setgad gui4cli.gc 71 off
setgad gui4cli.gc 60/63 off
setgad gui4cli.gc 72 on
lvhelp = 'Double click on a directory, or hit FAV again to cancel'
lvmode MULTI
lvchange guis:tools/fav/G4C.fav
lvsort asc
mode = FAV
endif
XBUTTON 252 27 29 14 "+"
gadid 71
gadhelp 'Adds the current dir the Listview is at, to your favourites'
lvuse gui4cli.gc 10
append guis:tools/fav/g4c.fav '\n$$lv.dir'
XBUTTON 252 42 29 14 "-"
gadid 72
gadhelp 'Deletes selected favourite entries'
lvuse gui4cli.gc 10
lvmulti first
while $guivar > ''
lvdel -1
lvmulti first
endwhile
XBUTTON 192 42 58 14 "Save"
gadid 72
gadhelp 'Save favourites to GUIs:tools/fav/G4C.fav'
lvuse gui4cli